/*
 * @Description:Integer
 * 
 * @Author: rendc
 * 
 * @Date: 2025-08-07 10:05:57
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2025-08-07 14:45:08
 */
public class Test02Integer {

  public static void main(String[] args) {
    // 基本数据类型 - 栈空间
    int a = 10;
    int b = 10;
    System.out.println("a==b:" + (a == b));// true
    // 引用数据类型 - 对象 - 栈空间 - 堆空间
    Integer a1 = new Integer(10);
    Integer b1 = new Integer(10);
    System.out.println(a1); // 10
    System.out.println(b1); // 10
    System.out.println("10==10:" + ("10" == "10"));// 为什么是true?
    System.out.println("a1:" + System.identityHashCode(a1));
    System.out.println("b1:" + System.identityHashCode(b1));
    System.out.println("a1==b1:" + (a1 == b1));// false
    // 引用数据类型 - 对象 - 栈空间 - 堆空间 - 自动装箱
    Integer a3 = 10;
    Integer b3 = 10;
    System.out.println("a3:" + System.identityHashCode(a3));
    System.out.println("b3:" + System.identityHashCode(b3));
    System.out.println("a3==b3:" + (a3 == b3));// true
    int num = 128;
    // 引用数据类型 - 对象 - 栈空间 - 堆空间 - 自动装箱
    Integer a4 = num;
    Integer b4 = num;
    System.out.println("a4:" + System.identityHashCode(a4));
    System.out.println("b4:" + System.identityHashCode(b4));
    System.out.println("a4==b4:" + (a4 == b4));// false

  }
}